﻿{% extends "base.html" %}



{% block css %}
<link rel="stylesheet" href="/static/css/admin.css">
<link rel="stylesheet" href="/static/ztree3/css/bootstrapStyle/bootstrapStyle.css" type="text/css">
{% endblock %}


{% block center %}


<!--头部导航-->
<!--
<div class="panel panel-default center-top" style="min-width:1300px;">
  <div class="panel-body">
    <ol class="breadcrumb" style="margin-bottom: 0px;background-color: #FFFFFF;">
      <li><a href="/" style="color: #377CD8;">首页</a></li>
      <li><a href="#">系统管理</a></li>
      <li class="active">{{ title }}</li>
    </ol>
  </div>
</div>
-->


<!--用户信息-->
<div class="panel panel-default center-top" style="min-width:1300px;">
  <div class="panel-heading">
      <div class="row" style="padding-top:5px;padding-left:10px;">
           <div class="col-sm-3">

                <ol class="breadcrumb" style="margin-bottom: 0px;">
                  <li><a href="/" style="color: #377CD8;">首页</a></li>
                  <li><a href="#">运维工具</a></li>
                  <li class="active">{{ title }}</li>
                </ol>

          </div>

          <div class="col-sm-2" style="padding-left:10px" id="tag">
                <a class="btn btn-primary">{{ info.hostname }}</a>

          </div>

          <div class="col-sm-2">


              <input type="file" class="form-control" id="upfile">


          </div>

          <div class="col-sm-2">

              <div class="input-group">
                  <span class="input-group-addon" id="basic-addon1">path</span>

                  <input type="text" class="form-control" placeholder="/" id="up-path" value="/opt/upload/">
                  <span class="input-group-btn">
                    <button class="btn btn-info" type="button" id="btn-upfile">上传</button>
                  </span>
              </div>
          </div>

          <div class="col-sm-3" >
              <div class="input-group">
                  <span class="input-group-addon">path</span>

                  <input type="text" class="form-control" placeholder="/PATH/TO/filename" id="down-path">

                  <span class="input-group-btn">
                    <button class="btn btn-success" type="button" id="btn-downfile">下载</button>
                  </span>
              </div>

          </div>


      </div>

  </div>
  <div class="panel-body">

        <div class="row">
            <div class="col-sm-2" style="max-height:735px;overflow:auto;">

                <ul id="treeDemo" class="ztree"></ul>

            </div>


            <div class="col-sm-10" id="viewDiv">



            </div>

        </div>

  </div>
</div>


{% endblock %}


<!-- Modal -->
{% block modal %}


{% endblock  %}

{% block js %}
    <script type="text/javascript" src="/static/ztree3/js/jquery.ztree.core.js"></script>
    <script type="text/javascript" src="/static/ztree3/js/jquery.ztree.excheck.js"></script>
    <script type="text/javascript" src="/static/ztree3/js/jquery.ztree.exedit.js"></script>
    <script type="text/javascript" src="/static/js/tool.js"></script>
    <script type="text/javascript" >



    var setting = {
            view: {
                selectedMulti: false
            },
            check: {
                enable: false
            },
            data: {
                simpleData: {
                    enable: true
                }
            },
            edit: {
                enable: false
            }
        };


        var zNodes = {{ data |safe }};

        $(document).ready(function(){
            $.fn.zTree.init($("#treeDemo"), setting, zNodes);


            $("a[class='level1']").click(function(){
                var ip = $(this).attr("title");
                html='<a class="btn btn-primary">'+ip+'</a>';
                $("#tag").empty();
                $("#tag").append(html);

                $.post("/tool/webssh/",{"ip":ip},function(data){
                    load_home()
                })

            });

        });


        document.getElementById("viewDiv").innerHTML = '<object type="text/html" data="{{ webssh_url }}" width="100%" height="735px"></object>';


        function load_home() {
            document.getElementById("viewDiv").innerHTML = '<object type="text/html" data="{{ webssh_url }}" width="100%" height="735px"></object>';
          }



    </script>

{% endblock %}


